<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_JS运算符</title>
</head>
<body>
<script>
    console.log(6/3);//2
    console.log(3/2);//1.5
    //如果比较运算符任意一边有数字,会先转为数字再比较
    console.log(3 > 10);//false
    console.log(3 > '10');//false
    console.log('3' > 10);//false
    //如果比较运算符两边都是字符,比较的是编码
    //charCodeAt()查看字符编码,默认查看第一个字符,也可根据下标查看其它字符编码
    console.log('超' > '宇');//true
    console.log('超'.charCodeAt());
    console.log('宇'.charCodeAt());
    console.log('3' > '10');//true
    console.log('3'.charCodeAt());//51
    console.log('10301'.charCodeAt(4));//49

    let a = 1;
    let b = true;
    console.log(a == b);//松散比较运算符:只比较值 1与1值相等,结果true
    console.log(a === b);//严格比较运算符:先比较类型,类型一致再比较值 number≠boolean,结果是false

    let c = 0;
    console.log( c==0 ? 'YES' : 'NO');//yes
    console.log( c=0 ? 'YES' : 'NO');//no 一个=是赋值符号,c被赋值为0,转为布尔是false,所以取no
</script>
</body>
</html>